import apis from './'
import request from '@/utils/request'

export function getCompany (parameter) {
  return request({
    url: apis.InvoiceCompany,
    method: 'get',
    params: parameter
  })
}

export function getAddCompany () {
  return request({
    url: apis.AddInvoice,
    method: 'get'
  })
}

export function postAddCompany (data) {
  return request({
    url: apis.AddInvoice,
    method: 'post',
    data: data
  })
}

export function editPoint (data) {
  return request({
    url: `${apis.EditInvoicePoint}?ic_id=${data.id}`,
    method: 'post',
    data: data
  })
}

export function editZStock (data) {
  return request({
    url: `${apis.EditInvoiceZStock}?ic_id=${data.id}`,
    method: 'post',
    data: data
  })
}

export function editStock (data) {
  return request({
    url: `${apis.EditInvoiceStock}?ic_id=${data.id}`,
    method: 'post',
    data: data
  })
}

// export function editPStock (data) {
//   return request({
//     url: `${apis.EditInvoicePStock}?ic_id=${data.id}`,
//     method: 'post',
//     data: data
//   })
// }

export function delCompany (id) {
  return request({
    url: `${apis.DelCompany}?ic_id=${id}`,
    method: 'get'
  })
}

export function getUnInvoice (parameter) {
  return request({
    url: apis.UnInvoice,
    method: 'get',
    params: parameter
  })
}

export function getInvoiceList (parameter) {
  return request({
    url: apis.InvoiceList,
    method: 'get',
    params: parameter
  })
}

export function getInvoiceDetail (id) {
  return request({
    url: `${apis.InvoiceDetail}?invoice_id=${id}`,
    method: 'get'
  })
}

export function getCheck (id) {
  return request({
    url: `${apis.CheckInvoice}?invoice_id=${id}`,
    method: 'get'
  })
}

export function postCheck (data) {
  return request({
    url: `${apis.CheckInvoice}?invoice_id=${data.invoice_id}`,
    method: 'post',
    data: data
  })
}

export function getAddInfo (id) {
  return request({
    url: `${apis.AddInvoiceInfo}?invoice_id=${id}`,
    method: 'get'
  })
}

export function postAddInfo (data, id) {
  return request({
    url: `${apis.AddInvoiceInfo}?invoice_id=${id}`,
    method: 'post',
    data: data
  })
}

export function refuseInvoice (data, id) {
  return request({
    url: `${apis.RefuseInvoice}?invoice_id=${id}`,
    method: 'post',
    data: data
  })
}
